﻿using System;
using HighDiveEngine.Resources;

namespace HighDiveEngine.Model
{
    /// <summary>
    ///Data Class that holds data for a judge.
    /// </summary>
    public class Judge : Person , IEquatable<Judge>
    {
        #region Properties
        /// <summary>
        ///IdString used for identification when a score is updated by the judge.
        /// </summary>
        public  string IdString { get; set; }
        public  string IpAdress { get; set; }
        public int JudgeNumber { get; set; }
        public int? DbId { get; set; }
        public JudgeStatus Status { get; set; }

        #endregion

        #region Constructors

        public Judge()
        {
            IdString = null;
            IpAdress = null;
            PersonDbId = null;
            DbId = null;
            JudgeNumber = 0;
            Status = new JudgeStatus();
            Status.SetTo(JudgeStatus.Status.Na);
        }

        public Judge(Person person)
        {
            IpAdress = null;
            IdString = null;
            DbId = null;
            JudgeNumber = 0;
            Status = new JudgeStatus();
            Status.SetTo(JudgeStatus.Status.Na);

            IdNumber = person.IdNumber;
            FirstName = person.FirstName;
            LastName = person.LastName;
            Address = person.Address;
            Club = person.Club;
            Email = person.Email;
            PersonDbId = person.PersonDbId;
            Gender = person.Gender;
        }

        #endregion

        public bool Equals(Judge other)
        {
            return IdString == other.IdString;
        }

        public override string ToString()
        {
            return IdNumber + " " + FirstName + " " + LastName;
        }
    }
}
